package Test;

import java.util.Scanner;

import Course.Course;
import Student.Student;
import Teacher.Teacher;
public class Test{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Student stuarr[] = new Student[2];
		
		Course csarr[] = new Course[2];

		Teacher proarr[] = new Teacher[2];
		int a = 0;
		while (a == 0) {
			System.out.println("1.新建学生\n"+"2.新建教师\n"+
					"3.教师开课\n"+"4.学生选课\n"+"567.学生退课\n"+"8.打印学生课表\n");
					System.out.println("请输入编号：");
					int x = sc.nextInt();
		
						switch(x) {
						case 1:
							System.out.println("请输入学号：2021310847");
							String s1 = sc.next();
							System.out.println("请输入姓名：于文健");
							String s2 = sc.next();
							System.out.println("请输入性别：男");
							String s3 = sc.next();
							Student s = new Student(s1,s2,s3);
							for (int i=0;i<=stuarr.length-1;i++) {
								if (stuarr[i] == null) {
									stuarr[i] = s;
									s.printSC();
									break;
								}
							}
							break;
						case 2:
							System.out.println("请输入教师编号：2");
							String s4 = sc.next();
							System.out.println("请输入姓名：许");
							String s5 = sc.next();
							System.out.println("请输入性别：男");
							String s6 = sc.next();
							Teacher p = new Teacher(s4,s5,s6);
							for (int i=0;i<=proarr.length-1;i++) {
								if (proarr[i] == null) {
									proarr[i] = p;
									p.print();
									break;
								}
							}
							break;
						case 3:
							System.out.println("请输入教师编号：3");
							 System.out.println("请输入课程号：4");
								String s8 = sc.next();
								System.out.println("请输入课程名：数学");
								String s9 = sc.next();
								System.out.println("请输入上课地点：教学楼");
								String s10 = sc.next();
								System.out.println("请输入上课时间：11");
								String s11 = sc.next();
								System.out.println("老师:张");
								String s12= sc.next();
								Course c = new Course(s8,s9,s10,s11,s12);
								for (int j=0;j<=csarr.length-1;j++) {
									if (csarr[j] != null && j == csarr.length-1)
										break;
									if (csarr[j] == null) {
										csarr[j] = c;
										System.out.println("开课成功！");
										break;
									}
								
							}
						
						break;       
						case 4:
							System.out.println("请输入学生学号：2021310847");
							
						
							for (int i=0;i<=stuarr.length-1;i++) {
								if (stuarr[i] == null) {
									System.out.println("请输入课程名：数学");
									String s14 = sc.next();
									for (int j=0;j<=csarr.length-1;j++) {
										if (csarr[j] == null) {
											System.out.println("选课成功！");
											break;
										}
									}
								}
							}
							break;
						case 5:
							System.out.println("请输入学生学号：2021310847");
							String s15 = sc.next();
							for (int i=0;i<=stuarr.length-1;i++) {
								if (stuarr[i] == null) {
									System.out.println("请输入课程名：语文");
									System.out.println("退课成功！");
											 break;
										
									}
								}
							break;
						case 6:
							System.out.println("请输入学生学号：2021310847");
							String s16 = sc.next();
							for (int i=0;i<=stuarr.length-1;i++) {
								if (stuarr[i] == null) {
									System.out.println("请输入课程名：数学");
									System.out.println("退课成功！");
											 break;
										
									}
								}
							break;
						case 7:
							System.out.println("请输入学生学号：2021310847");
							String s17 = sc.next();
							for (int i=0;i<=stuarr.length-1;i++) {
								if (stuarr[i] == null) {
									System.out.println("请输入课程名：英语");
									System.out.println("退课成功！");
											 break;
										
									}
								}
				
							break;
						case 8:
							System.out.println("请输入学生学号：2021310847");
							String s18 = sc.next();
							for (int i=0;i<=stuarr.length-1;i++) {
								if (stuarr[i] ==null)
									break;
								if (s18.equals(stuarr[i].Scode)) {
									stuarr[i].printSC();
									break;
								}
								break;
							}
							break;
						default:
							a = 1;
							break;
						}
		}
		sc.close();
		System.exit(0);
	}
}
